package com.fjwt.gz.service.activity.platform.acte029;

import com.fjwt.gz.core.exception.BizException;
import com.fjwt.gz.db.dto.ActivityAwardDTO;
import com.fjwt.gz.db.entity.ActivityAwardEntity;
import com.fjwt.gz.db.entity.ActivityEntity;
import com.fjwt.gz.db.entity.ScoreRecordTotalEntity;
import com.fjwt.gz.db.entity.SysExportTaskEntity;
import com.fjwt.gz.db.vo.ExportAwardVO;
import com.fjwt.gz.service.activity.AbstractExportReport;
import com.fjwt.gz.service.impl.AwardScoreService;
import com.fjwt.gz.service.impl.FansAwardService;
import com.fjwt.gz.service.impl.ScoreRecordTotalService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * ------ 029码上有福活动导出报表
 */
@Slf4j
@Service
public class ACTE029ExportReport extends AbstractExportReport<ExportAwardVO> {

    @Autowired
    private AwardScoreService awardScoreService;

    private static final Map<String, String> headerScorcMap = new HashMap<>();

    static {
        headerScorcMap.put("fansId", "用户唯一ID");
        headerScorcMap.put("realName", "参与客户姓名");
        headerScorcMap.put("phone", "参与客户手机号");
        headerScorcMap.put("isAuth", "参与客户是否实名");
        headerScorcMap.put("score", "积分值");
        headerScorcMap.put("name", "积分名称");
        headerScorcMap.put("couponThirdId", "微信唯一卡券编号");
        headerScorcMap.put("createdAt", "参与时间");
        headerScorcMap.put("writeTime", "核销时间");
        headerScorcMap.put("status", "积分状态");
    }


    @Override
    public String exportActivityExcel(SysExportTaskEntity sysExportTaskEntity) {
        ActivityEntity activityEntity = getRequestParam(sysExportTaskEntity.getRequestParam(), ActivityEntity.class);
        ActivityAwardDTO activityAwardDTO = new ActivityAwardDTO( );
        activityAwardDTO.setAgentNo(activityEntity.getAgentNo());
        // 查询活动卡券
        List<ExportAwardVO> list= awardScoreService.activityScoreDetail(activityAwardDTO);

        return createExcelAndUploadOssUrl(list, headerScorcMap, sysExportTaskEntity);
    }
}
